//		Unwelcome neighbors: Poverty and Anti-Immigrant Sentiment in Morocco

										*Daniel Tuki*

** This study is based on data from Rounds 7 through 10 of the Afrobarometer surveys cinducted in Morocco between 2018 and 2024. To access the data and questionnaire visit: https://www.afrobarometer.org/

* The coldes below go with the data file named "pooled_data"

***********************************************************************************************
*											DESCRIPTIVES
***********************************************************************************************


// Table 1: Descriptive statistics 

summ hostile_migrant bin_hostile_migrant poverty_index food water medicine fuel income economy unemployed educ age male news_index urban unsafe more_job_seekers migrants_good 




// Figure 2: Hostility toward immigrants and foreign workers in Morocco
graph bar, over(hostile_migrant)



// Figure 3: Lived poverty among Moroccans 
graph bar, over (poverty_index)



***********************************************************************************************
*										REGRESSION RESULTS
***********************************************************************************************

// Table 2: Ordered logit models regressing hostility towards immigrants and foreign workers on lived poverty in Morocco

* Model 1: Considering only poverty index
ologit hostile_migrant poverty_index, vce(robust)
* To obtain the AIC statistic:
estat ic

* Model 2: Adding control variables
ologit hostile_migrant poverty_index economy unemployed educ age male news_index urban unsafe, vce(robust)
* To obtain the AIC statistic:
estat ic

* Model 3: Adding region and survey year fixed effects
ologit hostile_migrant poverty_index economy unemployed educ age male news_index urban unsafe i.year i.region, vce(robust)
* To obtain the AIC statistic:
estat ic

* Model 4: Using a binary version of the dependent variable (LPM)
regress bin_hostile_migrant poverty_index economy unemployed educ age male news_index urban unsafe i.year i.region, vce(robust)
* To obtain the AIC statistic:
estat ic



// Figure 4: Predicted probabilities showing the association between lived poverty and hostility toward immigrants and foreign workers. 

* Based on Model 1 in Table 2
ologit hostile_migrant poverty_index, vce(robust)
* To obtain the marginal effects for news consumption
margins, dydx(poverty_index)
*To plot the marginal effects as a bar chart with confidence intervals
marginsplot, recast(bar) yline(0) name (poverty_index, replace)



// Table 3: Ordered logit models regressing hostility towards immigrants and foreign workers on the respective components of the lived poverty

* Model 1: Food
ologit hostile_migrant food economy unemployed educ age male news_index urban unsafe i.year i.region, vce(robust)
* To obtain the AIC statistic:
estat ic

* Model 2: Water
ologit hostile_migrant water economy unemployed educ age male news_index urban unsafe i.year i.region, vce(robust)
* To obtain the AIC statistic:
estat ic

* Model 3: Medicine
ologit hostile_migrant medicine economy unemployed educ age male news_index urban unsafe i.year i.region, vce(robust)
* To obtain the AIC statistic:
estat ic

* Model 4: Fuel
ologit hostile_migrant fuel economy unemployed educ age male news_index urban unsafe i.year i.region, vce(robust)
* To obtain the AIC statistic:
estat ic

* Model 5: income
ologit hostile_migrant income economy unemployed educ age male news_index urban unsafe i.year i.region, vce(robust)
* To obtain the AIC statistic:
estat ic



// Table 4: Subsample analysis based on gender and region of residence

* Model 1: Men only
ologit hostile_migrant poverty_index economy unemployed educ age news_index urban unsafe i.year i.region, vce(robust), if male == 1
* To obtain the AIC statistic:
estat ic

* Model 2: Women only
ologit hostile_migrant poverty_index economy unemployed educ age news_index urban unsafe i.year i.region, vce(robust), if male == 0
* To obtain the AIC statistic:
estat ic

* Model 3: Urban residence
ologit hostile_migrant poverty_index economy unemployed educ age male news_index unsafe i.year i.region, vce(robust), if urban == 1
* To obtain the AIC statistic:
estat ic


* Model 4: Rural residence
ologit hostile_migrant poverty_index economy unemployed educ age male news_index unsafe i.year i.region, vce(robust), if urban == 0
* To obtain the AIC statistic:
estat ic




// Table 5: Regressing attitudes toward immigrant job seekers and perceived economic impact of immigrants on lived poverty in Morocco

* Model 1: Admit more or fewer job seekers (More job seekers)
ologit more_job_seekers poverty_index i.region, vce(robust)
* To obtain the AIC statistic:
estat ic

* Model 2: Economic impact of foreign migrants (Migrants beneficial)
ologit migrants_good poverty_index  i.region, vce(robust)
* To obtain the AIC statistic:
estat ic



// Figure 5: Predicted probabilities showing the association between lived poverty, attitudes toward immigrant job seekers, and perceived economic impact of immigrants. 

* Panel A: More job seekers (Based on Model 1 in Table 5)
ologit more_job_seekers poverty_index i.region, vce(robust)
* To obtain the marginal effects for news consumption
margins, dydx(poverty_index)
*To plot the marginal effects as a bar chart with confidence intervals
marginsplot, recast(bar) yline(0) name (poverty_index_job_seekers, replace)


* Panel B: Perceived economic impact of immigrants (Based on Model 2 in Table 5)
ologit migrants_good poverty_index i.region, vce(robust)
* To obtain the marginal effects for news consumption
margins, dydx(poverty_index)
*To plot the marginal effects as a bar chart with confidence intervals
marginsplot, recast(bar) yline(0) name (poverty_index_migrants_good, replace)

* To combine the two graphs: 
graph combine poverty_index_job_seekers poverty_index_migrants_good





***********************************************************************************************
*											APPENDIX
***********************************************************************************************
* Table A1: Regressing hostility toward immigrants and foreign workers on migration aspirations
ologit hostile_migrant emiglike, vce(robust)
* To obtain the AIC and BIC statistics
estat ic


* Figure A1: Predicted probabilities showing the association between migration aspirations and hostiltiy towards immigrants and foreign workers
* Based on Model 1 in Table 2
ologit hostile_migrant emiglike, vce(robust)
* To obtain the marginal effects for news consumption
margins, dydx(emiglike)
*To plot the marginal effects as a bar chart with confidence intervals
marginsplot, recast(bar) yline(0) name (emiglike_migrant_hostile, replace) level (90)


// Additional test: T-test comparing hostility toward immigrants and foreign workers between Moroccans with migration aspirations versus those without. 
ttest hostile, by(emiglike)


* Some descriptive statistics referenced in the discussion section: 

// Men preferentially hired (Q49B): This variable measurs the degree to which respondents agree that when jobs are scare, men should be given peference over women. 
tab Q49B


// Women prevented from paid employment by family (Q52D): This variable measures respondents'; beliefs regarding the tfrequency with which families prevent women from taking paid employment
tab Q52D



// Main barrier to women's employment (Q94E): This variable asks respondents about the main barriers to women's participation in the labor market.
tab Q94E




















